/*
Written by Best Flash Solutions, Inc  
See:
	http://www.bestflashsolutions.com
Contact me: contact@bestflashsolutions.com
*/

/**
 * Read XML configuration for this application
 */
package com.bestflashsolutions.app
{	
	import mx.controls.Alert;
	
	public class AppInfo extends XMLLoader
	{	
		public static var bIsError: Boolean = false;
		//File XML to store configuration
		public static const CONFIG_FILE: String = "./assets/config/app.xml";
		//Red5 server
		public static var strRTMPServer: String;
		//http server
		public static var strHTTPServer: String;
		//Name of red5 application
		public static var strRTMPAppName: String;
		public static var strRTMPChatAppName: String;
		//Max joiners for room
		public static var nMaxJoiner: Number;
		
		public function AppInfo()
		{
			super();
		}
		
		//Read application params
		public function send():void {
			super.load(CONFIG_FILE);
		}
		
		//Process application params
		public function process():void {
			//Check and load default params
			if (objData.httpServer && objData.httpServer!="")
				AppInfo.strHTTPServer = objData.httpServer;
			else
				AppInfo.strHTTPServer = "localhost";
			
			if (objData.rtmpServer && objData.rtmpServer!="")
				AppInfo.strRTMPServer = objData.rtmpServer;
			else
				AppInfo.strRTMPServer = "localhost";

			if (objData.rtmpApp && objData.rtmpApp!="")
				AppInfo.strRTMPAppName = objData.rtmpApp;
			else
				AppInfo.strRTMPAppName = "webVideoConference";
			
			if (objData.rtmpChatApp && objData.rtmpChatApp!="")
				AppInfo.strRTMPChatAppName = objData.rtmpChatApp;
			else
				AppInfo.strRTMPChatAppName = "ChatProj";
			
			if (objData.maxJoiner && objData.maxJoiner!="")
				AppInfo.nMaxJoiner = objData.maxJoiner;
			else
				AppInfo.nMaxJoiner = 5;
		}
	}
}